/*
 * @Author: Xavier 1305433186@qq.com
 * @Date: 2024-07-27 16:15:43
 * @LastEditors: Xavier 1305433186@qq.com
 * @LastEditTime: 2024-08-13 14:13:37
 * @FilePath: \JS32T031_SDK\User\user.c
 * @Description:
 *
 * STAYTRUE (c) 2024 by ${Xavier}, All Rights Reserved.
 */
/*
 * @Author: Xavier 1305433186@qq.com
 * @Date: 2023-11-06 14:16:17
 * @LastEditors: Xavier 1305433186@qq.com
 * @LastEditTime: 2024-08-09 14:13:04
 * @FilePath: \KEIL-ARMd:\Users\HXD\Desktop\拓基\面板\JS32T031_SDK\User\user.c
 * @Description:
 *
 * STAYTRUE (c) 2023 by ${Xavier}, All Rights Reserved.
 */
/**
 ******************************************************************************
 * @file    User/user.c
 * @author  JUSHENG Application Team
 * @version V1.0.4
 * @date    12-14-2021
 * @brief   Main program body
 ******************************************************************************
 * @attention
 *
 * <h2><center>&copy; COPYRIGHT 2021 JUSHENG</center></h2>
 *
 *
 ******************************************************************************
 */

/* Includes ------------------------------------------------------------------*/
#include "include.h"
#include "user.h"
#include "tk_cfg.h"
#include "board.h"
#include "gpio_simulate_uart_V2\gpio_simulate_uart_V2.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Uart baud rate                            */
#define UART_BAUDRATE LL_UARTx_BAUDRATE
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/**
 * @brief  Uart initialization function
 * @param  None
 * @retval None
 */
void deg_uart_init(void)
{
  TYPE_LL_GPIO_INIT gpio_struct;
  /* UART configuration structure variable     */
  TYPE_LL_UART_INIT uart_cfg;
  memset(&gpio_struct, 0x00, sizeof(gpio_struct));
  /* Initialize the relevant variables of the UART */
  memset(&uart_cfg, 0x0, sizeof(uart_cfg));

  /* pb10 func1   rx   fpga:v18 pb11 func1   tx   fpga:u16 */
  gpio_struct.gpio_pin = LL_GPIO_PIN_11;
  gpio_struct.gpio_mode = LL_GPIO_MODE_AF;
  ll_gpio_init(GPIOA, &gpio_struct);
  ll_gpio_pin_af_config(GPIOA, LL_GPIO_PIN_SOURCE_11, LL_GPIO_AF_0);
  /* Configure UART baud rate to UART_BAUDRATE        */
  uart_cfg.baudrate = UART_BAUDRATE;
  uart_cfg.bit_width_sel = LL_UART_WORD_LENGTH_8B;
  uart_cfg.parity = LL_UART_PARITY_NO;
  uart_cfg.stop_bit_sel = LL_UART_STOP_1B;
  /* Call the UART driver configuration function */
  ll_uart_init(UART0, &uart_cfg);
  debug_select_interface_set(DEBUG_UART0);
  ll_uart_enable(UART0);
  //  delay_ms(1);
}

/*系统数据初始化*/
void system_data_init(void)
{
}
void system_init(void)
{
#if PRINTF_LOG
  simulate_uart_io_init(); //  模拟串口 使用系统定时器
                           //  printf("\r\n");
  delay_ms(100);
  printf("init\r\n");
#endif
#if DBG_NOR_EN
  deg_uart_init();
  DBG_NOR("deg_uart_init\r\n");
#endif
  task_clock_init(); // 任务时钟初始化

  board_init(); // 外设初始化

  //  system_data_init();
}

/**
 * @}
 */

/*************************** (C) COPYRIGHT 2021 JUSHENG ***** END OF FILE *****/
